def howmanyway(n):
    if n == 1:
        return 1
    if n == 2:
        return 2
    if n == 3:
        return 4
    return howmanyway(n-3)+howmanyway(n-2)+howmanyway(n-1)
print(howmanyway(5))